// components/diy/goods/goodsImage/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    diyPramas:{
      type:Object
    },
    diyStyle:{
      type:Object
    },
    diyData:{
      type:Object
    },
    listType:{
      type:String
    },
    goodsdata:{
      type:String
    },
    stopTime:{
      type:String
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    goodsicon:''
  },

  /**
   * 组件的方法列表
   */
  methods: {
        /**
       * 商品详情跳转
       */
      goDetail: function (e) {
        let gid = ''
        if(this.properties.goodsdata == '2'){
          gid = this.properties.diyData.id
          wx.navigateTo({ url:  `/pages/activity/goods_combination_details/index?id=`+gid });
        }else if(this.properties.goodsdata == '3'){
          gid = this.properties.diyData.id
          wx.navigateTo({ url: '/pages/activity/goods_seckill_details/index?id=' + gid + '&time=' + this.properties.stopTime + '&status=1'});
        }else if(this.properties.goodsdata == '4'){
            gid = this.properties.diyData.id
              wx.navigateTo({
                url: '/pages/activity/goods_bargain_details/index?id='+gid
              });
        }else{
          gid = this.properties.diyData.gid
          wx.navigateTo({ url: `/pages/goods_details/index?id=` + gid });
        }        
      },
  },

  lifetimes:{
    ready(){
        var goodsicon =  this.properties.diyStyle.goodsicon
        if(goodsicon == 'recommand'){
          this.setData({
            goodsicon:'推荐'
          })
        }else if(goodsicon == 'hotsale'){
          this.setData({
            goodsicon:'热销'
          })
        }else if(goodsicon == 'isnew'){
          this.setData({
            goodsicon:'新上'
          })
        }else if(goodsicon == 'sendfree'){
          this.setData({
            goodsicon:'包邮'
          })
        }else if(goodsicon == 'istime'){
          this.setData({
            goodsicon:'限时卖'
          })
        }else if(goodsicon == 'bigsale'){
          this.setData({
            goodsicon:'促销'
          })
        }
    }
  }
})
